<?php
/*  法规的录入功能
*/
class InitCmembersAction extends Action {
  function _initialize() {

  }

  public function index() {
    echo "Begin<br/>";
    $m = M();
    $sql = "select * from pw_colonys";
    $list = $m->query($sql);
    foreach ($list as $k => $v) {
      $id = $v["id"];
      $sql = "select count(*) from pw_cmembers where colonyid = $id";
      $members = $m->query($sql);
      $members = $members[0]["count(*)"];
      $sql = "update pw_colonys set members = $members where id = $id";
      $m->query($sql);
      echo "更新了第".$k."条记录<br/>";
    }
  }
}
?>
